Added an unwatch method, so that XendDomainInfo can unregister the watch from
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 16 Nov 2005 14:27:59 +0000 (15:27 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 16 Nov 2005 14:27:59 +0000 (15:27 +0100)
outside the watch handler.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/xenstore/xswatch.py

index fbf165c019b31615fe41c6ca49a0df34c8637c4d..0f8b60d8b8f90f312bd9eeef489aee362f06315b 100644 (file)
@@ -22,6 +22,10 @@ class xswatch:
         xs.watch(path, self)
 
 
+    def unwatch(self):
+        xs.unwatch(self.path, self)
+
+
 watchThread = None
 xs = None
 xslock = threading.Lock()
@@ -49,7 +53,7 @@ def watchMain():
             watch = we[1]
             res = watch.fn(*watch.args, **watch.kwargs)
             if not res:
-                xs.unwatch(watch.path, watch)
+                watch.unwatch()
         except:
             log.exception("read_watch failed")
             # Ignore this exception -- there's no point throwing it